const iconMap = {
  img: {
    type: ['bmp', 'jpg', 'png', 'tiff', 'gif', 'pcx', 'tga', 'exif', 'fpx', 'svg', 'psd', 'cdr', 'pcd', 'dxf', 'ufo', 'eps', 'ai', 'raw', 'WMF', 'webp', 'ico'],
    icon: 'icon-picture-color'
  },
  excel: {
    type: ['xls', 'xlsx', 'csv'],
    icon: 'icon-excel-color'
  },
  word: {
    type: ['doc', 'docx', 'rtf'],
    icon: 'icon-word-color'
  },
  ppt: {
    type: ['ppt'],
    icon: 'icon-ppt-color'
  },
  pdf: {
    type: ['pdf'],
    icon: 'icon-pdf-color'
  },
  video: {
    type: ['avi', 'wmv', 'mpeg', 'mp4', 'mov', 'mkv', 'flv', 'f4v', 'm4v', 'rmvb', 'rm', '3gp', 'dat', 'ts', 'mts', 'vob'],
    icon: 'icon-video-color'
  },
  audio: {
    type: ['mp3', 'aiff', 'wav', 'pcm', 'aac', 'ogg', 'wma', 'alac'],
    icon: 'icon-music-color'
  },
  zip: {
    type: ['zip', 'rar'],
    icon: 'icon-package-color'
  }
}

export const iconFilter = function (type) {
  type = type.toLowerCase()
  let icon = 'icon-unknown-color'
  Object.keys(iconMap).some((key) => {
    if (iconMap[key].type.indexOf(type) !== -1) {
      icon = iconMap[key].icon
      return true
    }
    return false
  })
  return '#' + icon
}
